#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2017-2019, Intel Corporation
#
#
# pmempool_sync/TEST14 -- test for fixing pools with device dax using sync
#
# Device DAX devices with 2M alignment.
# 2nd variant of alignment configuration
#

. ../unittest/unittest.sh

require_test_type medium
require_fs_type any

# the test takes too long under pmemcheck
configure_valgrind pmemcheck force-disable

require_dax_device_alignments $SIZE_4KB $SIZE_2MB $SIZE_4KB $SIZE_2MB

setup

dax_device_zero

LOG=out${UNITTEST_NUM}.log
rm -f $LOG && touch $LOG

POOLSET=$DIR/testset1
create_poolset $POOLSET \
	O SINGLEHDR \
	AUTO:${DEVICE_DAX_PATH[0]} \
	AUTO:${DEVICE_DAX_PATH[1]} \
	R \
	AUTO:${DEVICE_DAX_PATH[2]} \
	AUTO:${DEVICE_DAX_PATH[3]}

expect_normal_exit $PMEMPOOL$EXESUFFIX create obj $POOLSET
expect_normal_exit $PMEMPOOL$EXESUFFIX rm -f ${DEVICE_DAX_PATH[0]}
expect_normal_exit $PMEMPOOL$EXESUFFIX rm -f ${DEVICE_DAX_PATH[1]}
expect_normal_exit $PMEMPOOL$EXESUFFIX sync $POOLSET >> $LOG
expect_normal_exit $PMEMPOOL$EXESUFFIX info $POOLSET &> /dev/null

pass
